package com.moon.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DriverManagerDataSource;

@Configuration
public class JdbcConfig {
    @Value("${a}")
    private String a;
    @Value("${b}")
    private String b;
    @Value("${c}")
    private String c;
    @Value("${d}")
    private String d;

    @Bean
    public JdbcTemplate jdbcTemplate(){
        JdbcTemplate jdbcTemplate = new JdbcTemplate();
        DriverManagerDataSource dataSource = new DriverManagerDataSource();
        dataSource.setDriverClassName(a);
        dataSource.setUrl(b);
        dataSource.setUsername(c);
        dataSource.setPassword(d);
        jdbcTemplate.setDataSource(dataSource);
        return jdbcTemplate;
    }
}
